Background

Column

About the Project

This project is completely made up and looks to examine whether coffee consumed has any bearing on words written per day in PhD students.
Hopefully by the end of this you get an idea of what flexdashboards can do and whether you need more coffee.
Here is a picture that is embedded in the document. This guy makes a great coffee

Column

Data

Column

Lets have a look at the data visually. To do this we can embed a couple of plots and a filter for our data

The filter has some downsides compared to Shiny. When you open the html file everything is displayed and there is no option for a default. The All function doesn’t function either so you can make select multiple available.

Other options if you don’t love this is to just use the interactivity of the plotly object.

On this page we also have a tab structure so you can flick through different plots.
You can also make a filter that is a slider

Note that the slider obliterates the boxplot because it doesn’t have an element that depends on “Day”

Column

Coffee vs Time

Words vs Time

Words

Results

Column

To answer this question we might want to fit a mixed model to our data.
Using lme4 we fit this model

Model = lmer(Words ~ Coffee + (1+Coffee|Student), data = Data)


We can output some model information directly into the dashboard

summary(Model)$coefficients
             Estimate Std. Error   t value
(Intercept) 329.35220   67.21533 4.8999567
Coffee       13.28772   19.79733 0.6711874
coefficients(Model)
$Student
          (Intercept)     Coffee
Student 1    453.0706  38.645517
Student 2    287.3432   4.677394
Student 3    466.2649  41.349876
Student 4    203.7830 -12.449426
Student 5    236.2993  -5.784757

attr(,"class")
[1] "coef.mer"

Column

We might also like to make a plot of our model

As we can see there is a potential positive benefit for having more coffees when wanting to write more words. If in doubt have more coffee.